package com.faithnmn.learnenglishbc.util;

import java.io.File;
import java.io.IOException;

import android.content.Context;
import android.os.Environment;

public class StorageUtil {
	public static final String ROOT_FOLDER = Environment.getExternalStorageDirectory().getAbsolutePath()+"/EasyEnglishBC/";
	public static final String AUDIO_FOLDER = ROOT_FOLDER+"audio";
	public static void init(Context context){
		File folder = new File(AUDIO_FOLDER);
		folder.mkdirs();
		folder = new File(AUDIO_FOLDER+"/.nomedia");
		try {
			folder.createNewFile();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public static boolean checkAudioAvailable(String audioName){
		File audioFile = new File(AUDIO_FOLDER+"/"+audioName+".mp3");
		return audioFile.exists();
	}
}
